import time

class auth():
    def save_login(appid,email_address):
        with open(f'{appid}.txt','w') as file:
            file.write(f'{email_address}')
            file.close()
        return 1
    def read_login(appid,email_address):
        try:
            with open(f'{appid}.txt','r') as file:
                email = file.read().split(',')[0]
                date = int(file.read().split(',')[1])
                now = time.time()
                if email == email_address and date+86400 >= now:
                    with open(f'{appid}.txt','w') as file2:
                        file2.write(f'{email_address},{now}')
                        file2.close()
                    return True
                else:
                    return False
        except:
            return False